#ifndef _MULTICASTSOCKE_HPP_
#define _MULTICASTSOCKE_HPP_

#include "jhdefs.hpp"
#include "net/DatagramSocket.hpp"

NET_NAMESPACE_BEGIN

class CMulticastSocket : public CDatagramSocket
{
public:
	CMulticastSocket();
	explicit CMulticastSocket(CIPAddress::Family family);
	CMulticastSocket(const CSocketAddress& address, bool reuseAddress = false);
	CMulticastSocket(const CSocket& socket);
	~CMulticastSocket();
	CMulticastSocket& operator = (const CSocket& socket);

	//void setInterface(const NetworkInterface& interfc);
	//NetworkInterface getInterface() const;

	void setLoopback(bool flag);
	bool getLoopback() const;

	void setTimeToLive(unsigned value);
	unsigned getTimeToLive() const;

	void joinGroup(const CIPAddress& groupAddress);
	//void joinGroup(const CIPAddress& groupAddress, const NetworkInterface& interfc);

	void leaveGroup(const CIPAddress& groupAddress);
	//void leaveGroup(const CIPAddress& groupAddress, const NetworkInterface& interfc);

private:
	//static NetworkInterface findFirstInterface(const IPAddress& groupAddress);

};

NET_NAMESPACE_END

#endif
